/**
 * 封装素材相关操作
 */
import request from '@/utils/request.js'

/**
 * 获取用户素材图片
 * @param {*} param0
 */
// eslint-disable-next-line camelcase
export const getImages = ({ collect = null, page = 1, per_page = 10 }) => {
  return request({
    method: 'GET',
    url: '/mp/v1_0/user/images',
    params: {
      collect,
      page,
      per_page
    }
  })
}

/**
 * 切换收藏图片
 * @param {*} id 图片的编号
 * @param {*} collect  是否收藏
 */
export const switchCollect = (id, collect) => {
  return request({
    method: 'PUT',
    url: '/mp/v1_0/user/images/' + id,
    data: {
      collect
    }
  })
}

/**
 * 删除图片
 * @param {*} id 图片编号
 */
export const deleteImage = id => request({
  method: 'DELETE',
  url: '/mp/v1_0/user/images/' + id
})
